import moment from 'moment';
// 时间转化
export default function timeToHms(sum: any) {
  var x = sum;

  var d = moment.duration(x, 'seconds');

  var hours: any = Math.floor(d.asHours()).toString();

  var mins: any = (Math.floor(d.asMinutes()) - hours * 60).toString();

  var second = (Math.floor(d.asSeconds()) - hours * 60 * 60 - mins * 60).toString();

  if (hours.toString().length == 1) {
    hours = '0' + hours;
  }
  if (mins.toString().length == 1) {
    mins = '0' + mins;
  }
  if (second.toString().length == 1) {
    second = '0' + second;
  }
  return hours + ':' + mins + ':' + second;
}
